package com.example.mes.web.controller;
import com.example.mes.model.PageResult;
import com.example.mes.model.WorkerInfo;
import com.example.mes.service.Imple.WorkerImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;


import javax.jws.WebParam;

@Controller
@RequestMapping("worker")
@Api( tags = "职工数据相关的接口", description = "职工数据测试接口")
@CrossOrigin
public class WorkerOrderController {
@Autowired
    private  WorkerImpl worker;
 //    private Environment env;获取配置文件对象
//    @Value("${spring.datasource.url}")
//    private String url;获取配置文件的信息
    @GetMapping("list")
    @ApiOperation(value = "职工列表数据")
    @ResponseBody
    public PageResult index(){
        PageResult<WorkerInfo> res = worker.findList();
        return res;

    }
@GetMapping("workerPage")
public String workerPage(){
    return "worker/list.html";
}
@GetMapping("deleteById")
    public String deleteById(int id){
    System.out.println(id);
        worker.deleteById(id);
    return "worker/list.html";
}
}
